package cn.yunyichina.provider.clinic.vo;

import cn.yunyichina.provider.iface.entity.base.OrderExtVo;
import cn.yunyichina.utils.convert.JsonUtils;
import com.alibaba.fastjson.JSONObject;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

public class ListMzfeeOutVoResponse {

    private String mzFeeId;

    private String mzBillId;

    private String yytOrderNo;

    private String recipeType;

    private String recipeId;

    private String createdTime;

    private String deptCode;

    private String deptName;

    private String doctorCode;

    private String doctorName;

    private Integer isInsurance;

    private Integer payAmount;

    private Integer accountAmount;

    private Integer medicareAmount;

    private Integer insuranceAmount;

    private Integer totalAmount;
    
    private String yytQrcode;

    private Short yytOrderType;

    /* 诊疗卡类型*/
    private Short patCardType;

    /* 医保卡号 */
    private String patCardNo;

    private String canBuyOut;

    private String payType ; //结算方式类型 1：自费 2：医保 3：公费 4：农村合作医疗 5：线下缴费

    private String hisRecordTime;

    public String getMzFeeId() {
        return mzFeeId;
    }

    public void setMzFeeId(String mzFeeId) {
        this.mzFeeId = mzFeeId;
    }

    public String getMzBillId() {
        return mzBillId;
    }

    public void setMzBillId(String mzBillId) {
        this.mzBillId = mzBillId;
    }

    public String getYytOrderNo() {
        return yytOrderNo;
    }

    public void setYytOrderNo(String yytOrderNo) {
        this.yytOrderNo = yytOrderNo;
    }

    public String getRecipeType() {
        return recipeType;
    }

    public void setRecipeType(String recipeType) {
        this.recipeType = recipeType;
    }

    public String getRecipeId() {
        return recipeId;
    }

    public void setRecipeId(String recipeId) {
        this.recipeId = recipeId;
    }

    public String getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(String createdTime) {
        this.createdTime = createdTime;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public String getDoctorCode() {
        return doctorCode;
    }

    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }

    public String getDoctorName() {
        return doctorName;
    }

    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }

    public Integer getIsInsurance() {
        return isInsurance;
    }

    public void setIsInsurance(Integer isInsurance) {
        this.isInsurance = isInsurance;
    }

    public Integer getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(Integer payAmount) {
        this.payAmount = payAmount;
    }

    public Integer getAccountAmount() {
        return accountAmount;
    }

    public void setAccountAmount(Integer accountAmount) {
        this.accountAmount = accountAmount;
    }

    public Integer getMedicareAmount() {
        return medicareAmount;
    }

    public void setMedicareAmount(Integer medicareAmount) {
        this.medicareAmount = medicareAmount;
    }

    public Integer getInsuranceAmount() {
        return insuranceAmount;
    }

    public void setInsuranceAmount(Integer insuranceAmount) {
        this.insuranceAmount = insuranceAmount;
    }

    public Integer getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(Integer totalAmount) {
        this.totalAmount = totalAmount;
    }

    public String getYytQrcode() {
        return yytQrcode;
    }

    public void setYytQrcode(String yytQrcode) {
        this.yytQrcode = yytQrcode;
    }

    public Short getYytOrderType() {
        return yytOrderType;
    }

    public Short getPatCardType() {
        return patCardType;
    }

    public void setPatCardType(Short patCardType) {
        this.patCardType = patCardType;
    }

    public String getPatCardNo() {
        return patCardNo;
    }

    public void setPatCardNo(String patCardNo) {
        this.patCardNo = patCardNo;
    }

    public void setYytOrderType(Short yytOrderType) {
        this.yytOrderType = yytOrderType;
    }

    public String getCanBuyOut() {
        return canBuyOut;
    }

    public void setCanBuyOut(String canBuyOut) {
        this.canBuyOut = canBuyOut;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public String getHisRecordTime() {
        return hisRecordTime;
    }

    public void setHisRecordTime(String hisRecordTime) {
        this.hisRecordTime = hisRecordTime;
    }

    public static List<ListMzfeeOutVoResponse> convertClinciRecordToMzfeeOut(List<OrderExtVo> orders) {
        List<ListMzfeeOutVoResponse> responses = new ArrayList<ListMzfeeOutVoResponse>();

        for (OrderExtVo order : orders) {
            ListMzfeeOutVoResponse response = new ListMzfeeOutVoResponse();
            JSONObject extraParamsMap = JsonUtils.parseObject(order.getExtraParams());
            response.setMzFeeId(extraParamsMap.getString("mz_fee_id"));
            response.setMzBillId(extraParamsMap.getString("mz_bill_id"));
            response.setYytOrderNo(order.getOrderNo());
            response.setCreatedTime(order.getCreatedTime());
            response.setDeptName(order.getDeptName());
            response.setDoctorName(order.getDoctorName());
            response.setIsInsurance(order.getIsInsurance().intValue());
            response.setPayAmount(order.getPayAmount());
            response.setInsuranceAmount(order.getInsuranceAmount());
            response.setAccountAmount(order.getAccountAmount());
            response.setMedicareAmount(order.getMedicareAmount());
            response.setTotalAmount(order.getTotalAmount());
            response.setYytQrcode(extraParamsMap.getString("yyt_qrcode"));
            response.setYytOrderType(order.getOrderType());
            response.setPatCardType(order.getMedicalCardType());
            response.setPatCardNo(order.getMedicalCardNo());
            response.setDeptCode(order.getDeptCode());
            response.setDoctorCode(order.getDoctorCode());
            response.setRecipeType(extraParamsMap.getString("recipe_type"));
            response.setRecipeId(extraParamsMap.getString("recipe_id"));
            response.setCanBuyOut(extraParamsMap.getString("can_buy_out"));
            response.setHisRecordTime(extraParamsMap.getString("his_record_time"));
            response.setPayType(extraParamsMap.getString("pay_type"));
            responses.add(response);
        }

        return responses;
    }
}